********************************************************************************
********************************************************************************
* QUINLAN, SCHNAUDT, & LEWIS-BECK
* A POLITICAL HISTORY FORECAST OF BLOC SUPPORT IN THE 2025 GERMAN FEDERAL 
* ELECTION  
* ANALYSIS SYNTAX FILE (Including analysis in the paper's appendix)
* Last updated: Monday, November 17, 2025. 
********************************************************************************
********************************************************************************



********************************************************************************
********************************************************************************
* SYNTAX FILE TABLE OF CONTENTS
* #>>>  1: INSTRUCTIONS FOR USE OF SYNTAX FILE, PURPOSE OF SYNTAX FILE
**         GET DATA, & STATA SETUP FOR TIME SERIES 
* #>>>  2: SUMMARY STATS OF RELEVANT VARIABLES AND PLOTS (APPENDIX A)
* #>>>  3: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION - 
**         CENTRAL FORECAST (TABLE 1 & APPENDIX C, TABLES C1-C3) 
**#>>>  4: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION - 
**         CENTRAL FORECAST - OUT-OF-SAMPLE DIAGNOSTICS - JACKKNIFE APPROACH
**         (TABLE 1 JACKKNIFE)
**#>>>  5: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION - 
**         CENTRAL FORECAST - OUT-OF-SAMPLE DIAGNOSTICS - ONE-STEP-AHEAD 
**         APPROACH (TABLE 1 ONE STEP AHEAD)
* #>>>  6: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION - 
**         CENTRAL FORECAST - ADDITIONAL ROBUSTNESS CHECKS 
**         (APPENDIX C, TABLES C4-C7)
**#>>>  7: APPENDIX B
********************************************************************************
********************************************************************************



********************************************************************************
********************************************************************************
**#>>> 1: INSTRUCTIONS FOR USE OF SYNTAX FILE, PURPOSE OF SYNTAX FILE
**        GET DATA, & STATA SETUP FOR TIME SERIES 
********************************************************************************
********************************************************************************



********************************************************************************
** >>> INSTRUCTIONS FOR USE OF AND NAVIGATING FILE
********************************************************************************
* #>>>    = SECTION HEADER 
* *///    = ANALYSIS HEADER & INFORMATION
* ---     = HIGHLIGHTS RELEVANT MATERIAL IN PUBLISHED PAPER    
* ACHTUNG = POTENTIAL FILE PATH CHANGE REQUIRED
**************************************************************************** 



********************************************************************************
** >>> PURPOSE OF FILE
********************************************************************************
* This do-file serves to operationalize and append a series of variables relevant
* to the analysis reported in Quinlan, Schnaudt, and Lewis-Beck paper 
* "A POLITICAL HISTORY FORECAST OF BLOC SUPPORT IN THE 2025 GERMAN FEDERAL 
* ELECTION" published in PS: POLITICAL SCIENCE & POLITICS (2025)
* DOI: https://doi.org/10.1017/S1049096525000204



********************************************************************************
** >>> SETUP STATA, GET DATA, AND SETUP FOR TIME SERIES
********************************************************************************

*/// Make sure no other data in STATA 
clear all 


*/// Open Dataset (ACHTUNG: May require path change)



*/// Set time variable 
tset ElectionID



********************************************************************************
********************************************************************************
**#>>> 2: SUMMARY STATS OF RELEVANT VARIABLES AND PLOTS 
** (--- APPENDIX A)
********************************************************************************
********************************************************************************



********************************************************************************
** >>> 2.1 SUMMARY STATISTICS 
** (--- Table A1, Appendix A)
********************************************************************************

*/// Summary stats 
sum ZS_Union ZS_Union_PrevElec ZS_CDU ZS_CSU ZS_CDU_PrevElec ZS_CSU_PrevElec Migrant ZS_FDP Election_Post90a InGovt_GroKo Land_InGovt_Union_MP ZS_SPD ZS_SPD_PrevElec Land_InGovt_SPD_MP ZS_Others3 ZS_Others3_PrevElec Land_InGovt_Others3_MP ZS_SPD ZS_SPD_PrevElec StpAhead_Election_94 StpAhead_Election_98 StpAhead_Election_02 StpAhead_Election_05 StpAhead_Election_09 StpAhead_Election_13 StpAhead_Election_17 StpAhead_Election_21



********************************************************************************
** >>> 2.2 PLOTS (--- Appendix A, Figures A1-A4)
********************************************************************************

*/// Plot: UNION ZS Vote Share (--- Figure A1, Appendix A)
graph twoway (lfit ZS_Union ElectionDate_Y) (scatter ZS_Union ElectionDate_Y)



*/// Plot: SPD ZS Vote Share (--- Figure A2, Appendix A)
graph twoway (lfit ZS_SPD ElectionDate_Y) (scatter ZS_SPD ElectionDate_Y)



*/// Plot: OTHERS Vote Share (--- Figure A3, Appendix A)
graph twoway (lfit ZS_Others3 ElectionDate_Y) (scatter ZS_Others3 ElectionDate_Y)



*/// Plot: FDP ZS Vote Share (--- Figure A4, Appendix A)
graph twoway (lfit ZS_FDP ElectionDate_Y) (scatter ZS_FDP ElectionDate_Y)



********************************************************************************
********************************************************************************
**#>>> 3: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION - CENTRAL FORECAST 
** (--- Table 1 in paper; & Appendix C, Tables C1-C3)
********************************************************************************
********************************************************************************



********************************************************************************
** >>> 3.1: SUR REGRESSION MODEL 2025: CENTRAL FORECAST MODEL
** (--- Table 1 in paper) 
********************************************************************************


*///  CENTRAL FORECAST MODEL (PH Forecast for 2025 including Migrant Crisis Shock Variable) 
***   Regression Model & Information Criteria for Model Comparison: Union, SPD, and Others
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)(ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant)
estat ic  



********************************************************************************
** >>> 3.2: WITHIN-SAMPLE PREDICTIONS FOR EACH BLOC FOR EACH ELECTION
**          DERIVED FROM SUR REGRESSION MODEL 2025 CENTRAL FORECAST MODEL
** (--- Table C1-C3, Appendix C in paper) 
********************************************************************************


*/// Calculate predicted ZS values for UNION with 95% Confidence Intervals (--- Table C1, Appendix C)
predict ZS_Union_yhat, xb equation(ZS_Union)                                    //* Predict ZS UNION Vote Share
predict ZS_Union_errorPRED, stdp  equation(ZS_Union)                            //* Predict Standard Error of the Prediction UNION Model
generate ZS_Union_yhatlb = ZS_Union_yhat - invnormal(0.975)*ZS_Union_errorPRED  //* Predict ZS UNION Vote Share Confidence Interval Lower Bound
generate ZS_Union_yhatub = ZS_Union_yhat + invnormal(0.975)*ZS_Union_errorPRED  //* Predict ZS UNION Vote Share Confidence Interval Upper Bound


*/// Predicted ZS values for UNION with 95% Confidence Intervals by Election Year (--- Table C1, Appendix C)
tabstat ZS_Union_yhat, by(ElectionDate)                                         //* Predicted ZS UNION Vote Share by Election Year (See Table C1, Appendix C)
tabstat ZS_Union_errorPRED, by(ElectionDate)                                    //* PredictedStandard Error of the Prediction UNION Model by Election Year
tabstat ZS_Union_yhatlb, by(ElectionDate)                                       //* Predicted ZS UNION Vote Share CI Lower Bound by Election Year
tabstat ZS_Union_yhatub, by(ElectionDate)                                       //* Predicted ZS UNION Vote Share CI Upper Bound by Election Year



*/// Calculate predicted ZS values for SPD with 95% Confidence Intervals (--- Table C2, Appendix C)
predict ZS_SPD_yhat, xb equation(ZS_SPD)                                        //* Predict ZS SPD Vote Share
predict ZS_SPD_errorPRED, stdp  equation(ZS_SPD)                                //* Predict Standard Error of the Prediction SPD Model
generate ZS_SPD_yhatlb = ZS_SPD_yhat - invnormal(0.975)*ZS_SPD_errorPRED        //* Predict ZS SPD Vote Share Confidence Interval Lower Bound
generate ZS_SPD_yhatub = ZS_SPD_yhat + invnormal(0.975)*ZS_SPD_errorPRED        //* Predict ZS SPD Vote Share Confidence Interval Upper Bound



*/// Predicted ZS values for SPD with 95% Confidence Intervals by Election Year (--- Table C2, Appendix C)
tabstat ZS_SPD_yhat, by(ElectionDate)                                           //* Predicted ZS SPD Vote Share by Election Year (See Table C2, Appendix C)
tabstat ZS_SPD_errorPRED, by(ElectionDate)                                      //* PredictedStandard Error of the Prediction SPD Model by Election Year
tabstat ZS_SPD_yhatlb, by(ElectionDate)                                         //* Predicted ZS SPD Vote Share CI Lower Bound by Election Year
tabstat ZS_SPD_yhatub, by(ElectionDate)                                         //* Predicted ZS SPD Vote Share CI Upper Bound by Election Year



*/// Calculate predicted ZS values for OTHERS3 with 95% Confidence Intervals (--- Table C3, Appendix C)
predict ZS_OTH3_yhat, xb equation(ZS_Others3)                                   //* Predict ZS OTHERS Vote Share
predict ZS_OTH3_errorPRED, stdp  equation(ZS_Others3)                           //* Predict Standard Error of the Prediction OTHERS Model
generate ZS_OTH3_yhatlb = ZS_OTH3_yhat - invnormal(0.975)*ZS_OTH3_error         //* Predict ZS OTHERS Vote Share Confidence Interval Lower Bound
generate ZS_OTH3_yhatub = ZS_OTH3_yhat + invnormal(0.975)*ZS_OTH3_error         //* Predict ZS OTHERS Vote Share Confidence Interval Upper Bound



*/// Predicted ZS values for OTHERS3 with 95% Confidence Intervals by Election Year (--- Table C3, Appendix C)
tabstat ZS_OTH3_yhat, by(ElectionDate)                                          //* Predicted ZS OTHERS Vote Share by Election Year (See Table C3, Appendix C)
tabstat ZS_OTH3_errorPRED, by(ElectionDate)                                     //* PredictedStandard Error of the Prediction SPD Model by Election Year
tabstat ZS_OTH3_yhatlb, by(ElectionDate)                                        //* Predicted ZS OTHERS Vote Share CI Lower Bound by Election Year
tabstat ZS_OTH3_yhatub, by(ElectionDate)                                        //* Predicted ZS OTHERS Vote Share CI Upper Bound by Election Year



********************************************************************************
********************************************************************************
**#>>> 4: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION - 
**        CENTRAL FORECAST - OUT-OF-SAMPLE DIAGNOSTICS - JACKKNIFE APPROACH
**        (--- TABLE 1 JACKKNIFE)

** To determine how well our model predicts election results in the past, we 
** use a standard jackknife procedure (often referred to as "leave one out" 
** approach. We exclude one election from the model and re-estimate the model 
** and use that to predict the vote shares for the omitted election. We do 
** this for each election. We take all the errors emanating for each model 
** estimate, and calculate a mean absolute error of all errors. This overall 
** jackknife MAE for each bloc is reported in Table 1 in the "Out-of-sample 
** diagnostics: Jackknife". Further details on how the model estimates the 
** plurality vote share and how well it performs in doing so are provided in 
** the accompanying Excel sheet.
********************************************************************************
********************************************************************************

*/// SUR Model (Jacknife test excl 2021, Election ID=20)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19        

predict ZS_Union_yhat_JN2021, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 2017
tabstat ZS_Union_yhat_JN2021, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 2017 by Election Year

predict ZS_SPD_yhat_JN2021, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 2017
tabstat ZS_SPD_yhat_JN2021, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 2017 by Election Year

predict ZS_OTH3_yhat_JN2021, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 2017 
tabstat ZS_OTH3_yhat_JN2021, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 2017 by Election Year



*/// SUR Model (Jacknife test excl 2017, Election ID=19)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18  | ElectionID == 20         

predict ZS_Union_yhat_JN2017, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 2017
tabstat ZS_Union_yhat_JN2017, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 2017 by Election Year

predict ZS_SPD_yhat_JN2017, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 2017
tabstat ZS_SPD_yhat_JN2017, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 2017 by Election Year

predict ZS_OTH3_yhat_JN2017, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 2017 
tabstat ZS_OTH3_yhat_JN2017, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 2017 by Election Year



*/// SUR Model (Jacknife test excl 2013, Election ID=18)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 19  | ElectionID == 20         

predict ZS_Union_yhat_JN2013, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 2013
tabstat ZS_Union_yhat_JN2013, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 2013 by Election Year

predict ZS_SPD_yhat_JN2013, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 2013
tabstat ZS_SPD_yhat_JN2013, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 2013 by Election Year

predict ZS_OTH3_yhat_JN2013, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 2013 
tabstat ZS_OTH3_yhat_JN2013, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 2013 by Election Year



*/// SUR Model (Jacknife test excl 2009, Election ID=17)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 18 | ElectionID == 19 | ElectionID == 20               

predict ZS_Union_yhat_JN2009, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 2009
tabstat ZS_Union_yhat_JN2009, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 2009 by Election Year

predict ZS_SPD_yhat_JN2009, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 2009
tabstat ZS_SPD_yhat_JN2009, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 2009 by Election Year

predict ZS_OTH3_yhat_JN2009, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 2009 
tabstat ZS_OTH3_yhat_JN2009, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 2009 by Election Year



*/// SUR Model (Jacknife test excl 2005, Election ID=16)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19 | ElectionID == 20               

predict ZS_Union_yhat_JN2005, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 2005
tabstat ZS_Union_yhat_JN2005, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 2005 by Election Year

predict ZS_SPD_yhat_JN2005, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 2005
tabstat ZS_SPD_yhat_JN2005, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 2005 by Election Year

predict ZS_OTH3_yhat_JN2005, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 2005 
tabstat ZS_OTH3_yhat_JN2005, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 2005 by Election Year



*/// SUR Model (Jacknife test excl 2002, Election ID=15)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 14 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19  | ElectionID == 20              

predict ZS_Union_yhat_JN2002, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 2002
tabstat ZS_Union_yhat_JN2002, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 2002 by Election Year

predict ZS_SPD_yhat_JN2002, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 2002
tabstat ZS_SPD_yhat_JN2002, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 2002 by Election Year

predict ZS_OTH3_yhat_JN2002, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 2002 
tabstat ZS_OTH3_yhat_JN2002, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 2002 by Election Year



*/// SUR Model (Jacknife test excl 1998, Election ID=14)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 13 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19  | ElectionID == 20                    

predict ZS_Union_yhat_JN1998, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1998
tabstat ZS_Union_yhat_JN1998, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1998 by Election Year

predict ZS_SPD_yhat_JN1998, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1998
tabstat ZS_SPD_yhat_JN1998, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1998 by Election Year

predict ZS_OTH3_yhat_JN1998, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1998
tabstat ZS_OTH3_yhat_JN1998, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1998 by Election Year



*/// SUR Model (Jacknife test excl 1994, Election ID=13)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 12 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19 | ElectionID == 20                     

predict ZS_Union_yhat_JN1994, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1994
tabstat ZS_Union_yhat_JN1994, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1994 by Election Year

predict ZS_SPD_yhat_JN1994, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1994
tabstat ZS_SPD_yhat_JN1994, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1994 by Election Year

predict ZS_OTH3_yhat_JN1994, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1994
tabstat ZS_OTH3_yhat_JN1994, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1994 by Election Year



*/// SUR Model (Jacknife test excl 1990, Election ID=12)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==11  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19  | ElectionID == 20                    

predict ZS_Union_yhat_JN1990, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1990
tabstat ZS_Union_yhat_JN1990, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1994 by Election Year

predict ZS_SPD_yhat_JN1990, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1990
tabstat ZS_SPD_yhat_JN1990, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1990 by Election Year

predict ZS_OTH3_yhat_JN1990, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1990
tabstat ZS_OTH3_yhat_JN1990, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1990 by Election Year



*/// SUR Model (Jacknife test excl 1987, Election ID=11)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 10 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19 | ElectionID == 20                     

predict ZS_Union_yhat_JN1987, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1987
tabstat ZS_Union_yhat_JN1987, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1987 by Election Year

predict ZS_SPD_yhat_JN1987, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1987
tabstat ZS_SPD_yhat_JN1987, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1987 by Election Year

predict ZS_OTH3_yhat_JN1987, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1987
tabstat ZS_OTH3_yhat_JN1987, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1987 by Election Year



*/// SUR Model (Jacknife test excl 1983, Election ID=10)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==9  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19 | ElectionID == 20                     

predict ZS_Union_yhat_JN1983, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1983
tabstat ZS_Union_yhat_JN1983, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1983 by Election Year

predict ZS_SPD_yhat_JN1983, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1983
tabstat ZS_SPD_yhat_JN1983, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1983 by Election Year

predict ZS_OTH3_yhat_JN1983, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1983
tabstat ZS_OTH3_yhat_JN1983, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1983 by Election Year



*/// SUR Model (Jacknife test excl 1980, Election ID=9)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)(ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 8 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19 | ElectionID == 20                      

predict ZS_Union_yhat_JN1980, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1980
tabstat ZS_Union_yhat_JN1980, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1980 by Election Year

predict ZS_SPD_yhat_JN1980, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1980
tabstat ZS_SPD_yhat_JN1980, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1980 by Election Year

predict ZS_OTH3_yhat_JN1980, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1980
tabstat ZS_OTH3_yhat_JN1980, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1980 by Election Year



*/// SUR Model (Jacknife test excl 1976, Election ID=8)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==7 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19 | ElectionID == 20                      

predict ZS_Union_yhat_JN1976, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1976
tabstat ZS_Union_yhat_JN1976, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1976 by Election Year
 
predict ZS_SPD_yhat_JN1976, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1976
tabstat ZS_SPD_yhat_JN1976, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1976 by Election Year

predict ZS_OTH3_yhat_JN1976, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1976
tabstat ZS_OTH3_yhat_JN1976, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1976 by Election Year



*/// SUR Model (Jacknife test excl 1972, Election ID=7)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 6 | ElectionID ==8 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19 | ElectionID == 20                     

predict ZS_Union_yhat_JN1972, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1972
tabstat ZS_Union_yhat_JN1972, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1972 by Election Year

predict ZS_SPD_yhat_JN1972, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1972
tabstat ZS_SPD_yhat_JN1972, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1972 by Election Year

predict ZS_OTH3_yhat_JN1972, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1972
tabstat ZS_OTH3_yhat_JN1972, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1972 by Election Year



*/// SUR Model (Jacknife test excl 1969, Election ID=6)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)(ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==5  | ElectionID == 7 | ElectionID ==8 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19 | ElectionID == 20                     

predict ZS_Union_yhat_JN1969, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1969
tabstat ZS_Union_yhat_JN1969, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1969 by Election Year

predict ZS_SPD_yhat_JN1969, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1969
tabstat ZS_SPD_yhat_JN1969, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1969 by Election Year

predict ZS_OTH3_yhat_JN1969, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1969
tabstat ZS_OTH3_yhat_JN1969, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1969 by Election Year



*/// SUR Model (Jacknife test excl 1965, Election ID=5)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)(ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 4 | ElectionID ==6  | ElectionID == 7 | ElectionID ==8 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19  | ElectionID == 20                    

predict ZS_Union_yhat_JN1965, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1965
tabstat ZS_Union_yhat_JN1965, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1965 by Election Year

predict ZS_SPD_yhat_JN1965, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1965
tabstat ZS_SPD_yhat_JN1965, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1965 by Election Year

predict ZS_OTH3_yhat_JN1965, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1965
tabstat ZS_OTH3_yhat_JN1965, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1965 by Election Year



*/// SUR Model (Jacknife test excl 1961, Election ID=4)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 3 | ElectionID == 5 | ElectionID ==6  | ElectionID == 7 | ElectionID ==8 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19 | ElectionID == 20                     

predict ZS_Union_yhat_JN1961, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1961
tabstat ZS_Union_yhat_JN1961, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1961 by Election Year

predict ZS_SPD_yhat_JN1961, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1961
tabstat ZS_SPD_yhat_JN1961, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1961 by Election Year

predict ZS_OTH3_yhat_JN1961, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1961
tabstat ZS_OTH3_yhat_JN1961, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1961 by Election Year



*/// SUR Model (Jacknife test excl 1957, Election ID=3)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 2 | ElectionID == 4 | ElectionID == 5 | ElectionID ==6  | ElectionID == 7 | ElectionID ==8 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19 | ElectionID == 20                      

predict ZS_Union_yhat_JN1957, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1957
tabstat ZS_Union_yhat_JN1957, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1957 by Election Year

predict ZS_SPD_yhat_JN1957, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1957
tabstat ZS_SPD_yhat_JN1957, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1957 by Election Year

predict ZS_OTH3_yhat_JN1957, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1957
tabstat ZS_OTH3_yhat_JN1957, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1957 by Election Year



*/// SUR Model (Jacknife test excl 1953, Election ID=2)
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if ElectionID == 3 | ElectionID == 4 | ElectionID == 5 | ElectionID ==6  | ElectionID == 7 | ElectionID ==8 | ElectionID == 9 | ElectionID ==10  | ElectionID == 11 | ElectionID ==12  | ElectionID == 13 | ElectionID == 14 | ElectionID == 15 | ElectionID == 16 | ElectionID == 17 | ElectionID == 18 | ElectionID == 19  | ElectionID == 20                    

predict ZS_Union_yhat_JN1953, xb equation(ZS_Union)                             //* Predict ZS Union Vote Share JN 1953
tabstat ZS_Union_yhat_JN1953, by(ElectionDate)                                  //* Predicted ZS Union Vote Share JN 1953 by Election Year

predict ZS_SPD_yhat_JN1953, xb equation(ZS_SPD)                                 //* Predict ZS SPD Vote Share JN 1957
tabstat ZS_SPD_yhat_JN1953, by(ElectionDate)                                    //* Predicted ZS SPD Vote Share JN 1957 by Election Year

predict ZS_OTH3_yhat_JN1953, xb equation(ZS_Others3)                            //* Predicted ZS OTHERS Vote Share JN 1957
tabstat ZS_OTH3_yhat_JN1953, by(ElectionDate)                                   //* Predicted ZS OTHERS Vote Share JN 1957 by Election Year



********************************************************************************
********************************************************************************
**#>>>  5: VOTE SHARE MODELS - SEEMINGLY UNRELATED REGRESSION - 
**         CENTRAL FORECAST - OUT-OF-SAMPLE DIAGNOSTICS - ONE-STEP-AHEAD 
**         APPROACH (--- TABLE 1 ONE STEP AHEAD)
**         Please note: this analysis is only carried out on elections from 
**         1994 onwards. 
** To determine how well our model predicts election results in the past, we 
** use a one-step ahead procedure. All elections are sorted in chronological 
** order. We devise models relying entirely on data that would have been 
** accessible to the forecaster when making an ex-ante prediction and use that
** to predict the vote shares for the election in question. We do this for each 
** election going back to 1994. We take all the errors emanating for each model 
** estimate, and calculate a mean absolute error of all errors. This overall 
** one-step ahead MAE for each bloc is reported in Table 1 in the "Out-of-sample 
** diagnostics: One-step ahead". Further details on how the model estimates the 
** plurality vote share winner estimate and how well it performs in doing so 
** are provided in the accompanying Excel sheet.
********************************************************************************
********************************************************************************


*/// SUR Model (Step-Ahead Forecast: 2021 (Data: 1953-2017 for a 2021 forecast))
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if StpAhead_Election_21==1        

predict ZS_Union_yhat_StepAllbt21, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt21, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt21, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt21, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt21, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt21, by(ElectionDate)



*/// SUR Model (Step-Ahead Forecast: 2017 (Data: 1953-2013 for a 2017 forecast))
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if StpAhead_Election_17==1        

predict ZS_Union_yhat_StepAllbt17, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt17, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt17, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt17, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt17, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt17, by(ElectionDate)



*/// SUR Model (Step-Ahead Forecast: 2013 (Data: 1953-2009 for a 2013 forecast))
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if StpAhead_Election_13==1        

predict ZS_Union_yhat_StepAllbt13, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt13, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt13, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt13, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt13, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt13, by(ElectionDate)



*/// SUR Model (Step-Ahead Forecast: 2009 (Data: 1953-2005 for a 2009 forecast))
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if StpAhead_Election_09==1        

predict ZS_Union_yhat_StepAllbt09, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt09, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt09, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt09, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt09, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt09, by(ElectionDate)



*/// SUR Model (Step-Ahead Forecast: 2005 (Data: 1953-2002 for a 2005 forecast))
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if StpAhead_Election_05==1        

predict ZS_Union_yhat_StepAllbt05, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt05, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt05, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt05, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt05, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt05, by(ElectionDate)



*/// SUR Model (Step-Ahead Forecast: 2002 (Data: 1953-1998 for a 2002 forecast))
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if StpAhead_Election_02==1        

predict ZS_Union_yhat_StepAllbt02, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt02, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt02, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt02, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt02, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt02, by(ElectionDate)



*/// SUR Model (Step-Ahead Forecast: 1998 (Data: 1953-1994 for a 1998 forecast))
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if StpAhead_Election_98==1        

predict ZS_Union_yhat_StepAllbt98, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt98, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt98, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt98, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt98, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt98, by(ElectionDate)



*/// SUR Model (Step-Ahead Forecast: 1994 (Data: 1953-1990 for a 1994 forecast))
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant) if StpAhead_Election_94==1        

predict ZS_Union_yhat_StepAllbt94, xb equation(ZS_Union)
tabstat ZS_Union_yhat_StepAllbt94, by(ElectionDate)

predict ZS_SPD_yhat_StepAllbt94, xb equation(ZS_SPD)
tabstat ZS_SPD_yhat_StepAllbt94, by(ElectionDate)

predict ZS_OTH3_yhat_StepAllbt94, xb equation(ZS_Others3)
tabstat ZS_OTH3_yhat_StepAllbt94, by(ElectionDate)



********************************************************************************
********************************************************************************
**#>>> 6: ADDITIONAL ROBUSTNESS CHECKS & MODELS 
**        --- APPENDIX C, Tables C4-C6
********************************************************************************
********************************************************************************


********************************************************************************
** >>> 6.1: ROBUSTNESS CHECKS - VOTE SHARE MODELS - SEEMINGLY UNRELATED 
**          REGRESSION - CENTRAL FORECAST - CDU AND CSU AS SEPARATE ENTITIES
**          --- TABLE C4, APPENDIX C  
********************************************************************************


*///  CENTRAL FORECAST MODEL WITH CDU & CSU AS SEPARATE ENTITIES 
***   Regression Model & Information Criteria for Model Comparison: CDU, CSU, SPD, and Others
sureg (ZS_CDU ZS_CDU_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant) (ZS_CSU ZS_CSU_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP Migrant) (ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP Migrant)( ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP Migrant)
estat ic



********************************************************************************
** >>> 6.2: ROBUSTNESS CHECKS - NAIVE VOTE SHARE MODELS - SEEMINGLY UNRELATED 
**          REGRESSION
**          --- TABLE C5, APPENDIX C  
********************************************************************************


*///  Regression Model
sureg (ZS_Union ZS_Union_PrevElec) (ZS_SPD ZS_SPD_PrevElec )( ZS_Others3 ZS_Others3_PrevElec)
estat ic



*/// Calculate predicted ZS values for UNION with 95% Confidence Intervals: NAIVE MODELS
predict ZS_UnionNM_yhat, xb equation(ZS_Union)                                  //* Predict ZS UNION Vote Share
tabstat ZS_UnionNM_yhat, by(ElectionDate)                                       //* Predicted ZS UNION Vote Share by Election Year



*/// Calculate predicted ZS values for SPD with 95% Confidence Intervals: NAIVE MODELS
predict ZS_SPDNM_yhat, xb equation(ZS_SPD)                                      //* Predict ZS SPD Vote Share
tabstat ZS_SPDNM_yhat, by(ElectionDate)                                         //* Predicted ZS SPD Vote Share by Election Year



*/// Calculate predicted ZS values for OTHERS3 with 95% Confidence Intervals: NAIVE MODELS
predict ZS_OTH3NM_yhat, xb equation(ZS_Others3)                                 //* Predict ZS OTHERS3 Vote Share
tabstat ZS_OTH3NM_yhat, by(ElectionDate)                                        //* Predicted ZS OTHERS3 Vote Share by Election Year



********************************************************************************
** >>> 6.3: ROBUSTNESS CHECKS - POLITICAL HISTORY ORIGINAL MODELS - SEEMINGLY 
**          UNRELATED REGRESSION
**          --- TABLE C6, APPENDIX C 
********************************************************************************


*///  BASELINE MODEL (Original PH Forecast Model from 2021) 
***   Regression Model & Information Criteria for Model Comparison: Union, SPD, and Others
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP)(ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP)
estat ic  



*/// Calculate predicted ZS values for UNION with 95% Confidence Intervals 
predict BLZS_Union_yhat, xb equation(ZS_Union)                                        //* Predict ZS UNION Vote Share
predict BLZS_Union_errorPRED, stdp  equation(ZS_Union)                                //* Predict Standard Error of the Prediction UNION Model
generate BLZS_Union_yhatlb = BLZS_Union_yhat - invnormal(0.975)*BLZS_Union_errorPRED  //* Predict ZS UNION Vote Share Confidence Interval Lower Bound
generate BLZS_Union_yhatub = BLZS_Union_yhat + invnormal(0.975)*BLZS_Union_errorPRED  //* Predict ZS UNION Vote Share Confidence Interval Upper Bound



*/// Predicted ZS values for UNION with 95% Confidence Intervals by Election Year
tabstat BLZS_Union_yhat, by(ElectionDate)                                         //* Predicted ZS UNION Vote Share by Election Year (See Table C1, Appendix C)
tabstat BLZS_Union_errorPRED, by(ElectionDate)                                    //* PredictedStandard Error of the Prediction UNION Model by Election Year
tabstat BLZS_Union_yhatlb, by(ElectionDate)                                       //* Predicted ZS UNION Vote Share CI Lower Bound by Election Year
tabstat BLZS_Union_yhatub, by(ElectionDate)                                       //* Predicted ZS UNION Vote Share CI Upper Bound by Election Year



*/// Calculate predicted ZS values for SPD with 95% Confidence Intervals
predict BLZS_SPD_yhat, xb equation(ZS_SPD)                                            //* Predict ZS SPD Vote Share
predict BLZS_SPD_errorPRED, stdp  equation(ZS_SPD)                                    //* Predict Standard Error of the Prediction SPD Model
generate BLZS_SPD_yhatlb = BLZS_SPD_yhat - invnormal(0.975)*BLZS_SPD_errorPRED        //* Predict ZS SPD Vote Share Confidence Interval Lower Bound
generate BLZS_SPD_yhatub = BLZS_SPD_yhat + invnormal(0.975)*BLZS_SPD_errorPRED        //* Predict ZS SPD Vote Share Confidence Interval Upper Bound



*/// Predicted ZS values for SPD with 95% Confidence Intervals by Election Year
tabstat BLZS_SPD_yhat, by(ElectionDate)                                             //* Predicted ZS SPD Vote Share by Election Year (See Table C2, Appendix C)
tabstat BLZS_SPD_errorPRED, by(ElectionDate)                                        //* PredictedStandard Error of the Prediction SPD Model by Election Year
tabstat BLZS_SPD_yhatlb, by(ElectionDate)                                           //* Predicted ZS SPD Vote Share CI Lower Bound by Election Year
tabstat BLZS_SPD_yhatub, by(ElectionDate)                                           //* Predicted ZS SPD Vote Share CI Upper Bound by Election Year



*/// Calculate predicted ZS values for OTHERS3 with 95% Confidence Intervals
predict BLZS_OTH3_yhat, xb equation(ZS_Others3)                                   //* Predict ZS OTHERS Vote Share
predict BLZS_OTH3_errorPRED, stdp  equation(ZS_Others3)                           //* Predict Standard Error of the Prediction OTHERS Model
generate BLZS_OTH3_yhatlb = BLZS_OTH3_yhat - invnormal(0.975)*BLZS_OTH3_errorPRED         //* Predict ZS OTHERS Vote Share Confidence Interval Lower Bound
generate BLZS_OTH3_yhatub = BLZS_OTH3_yhat + invnormal(0.975)*BLZS_OTH3_errorPRED         //* Predict ZS OTHERS Vote Share Confidence Interval Upper Bound



*/// Predicted ZS values for OTHERS3 with 95% Confidence Intervals by Election Year
tabstat BLZS_OTH3_yhat, by(ElectionDate)                                          //* Predicted ZS OTHERS Vote Share by Election Year (See Table C3, Appendix C)
tabstat BLZS_OTH3_errorPRED, by(ElectionDate)                                     //* PredictedStandard Error of the Prediction SPD Model by Election Year
tabstat BLZS_OTH3_yhatlb, by(ElectionDate)                                        //* Predicted ZS OTHERS Vote Share CI Lower Bound by Election Year
tabstat BLZS_OTH3_yhatub, by(ElectionDate)                                        //* Predicted ZS OTHERS Vote Share CI Upper Bound by Election Year



********************************************************************************
** >>> 6.4: ROBUSTNESS CHECKS - POLLY CRISIS VOTE SHARE MODELS - SEEMINGLY  
**          UNRELATED REGRESSION
**          --- TABLE C7, APPENDIX C  
********************************************************************************


*///  Regression Model & Information Criteria for Model Comparison: Union, SPD, and Others
sureg (ZS_Union ZS_Union_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Union_MP PollyCrisis1)(ZS_SPD ZS_SPD_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_SPD_MP PollyCrisis1)(ZS_Others3 ZS_Others3_PrevElec Election_Post90a InGovt_GroKo Land_InGovt_Others3_MP PollyCrisis1)
estat ic  



*/// Calculate predicted ZS values for UNION with 95% Confidence Intervals: POLLY CRISIS
predict ZS_UnionPC_yhat, xb equation(ZS_Union)                                  //* Predict ZS UNION Vote Share
tabstat ZS_UnionPC_yhat, by(ElectionDate)                                       //* Predicted ZS UNION Vote Share by Election Year



*/// Calculate predicted ZS values for SPD with 95% Confidence Intervals: POLLY CRISIS
predict ZS_SPDPC_yhat, xb equation(ZS_SPD)                                      //* Predict ZS SPD Vote Share
tabstat ZS_SPDPC_yhat, by(ElectionDate)                                         //* Predicted ZS SPD Vote Share by Election Year



*/// Calculate predicted ZS values for OTHERS3 with 95% Confidence Intervals: POLLY CRISIS
predict ZS_OTH3PC_yhat, xb equation(ZS_Others3)                                 //* Predict ZS OTHERS3 Vote Share
tabstat ZS_OTH3PC_yhat, by(ElectionDate)                                        //* Predicted ZS OTHERS3 Vote Share by Election Year



********************************************************************************
********************************************************************************
**#>>> 7: APPENDIX B
** Appendix B provides the parameters used for the 2025 forecast, the 
** operationalization of all variables, and the full list of incumbent 
** governments. These materials are fully documented in the paper itself with 
** no additional code is required for this appendix.
********************************************************************************
********************************************************************************



***// END OF FILE
